import utils from '@/utils/util.js'
import storage from '@/storage/storage.js'
import config from '@/config/config.js'
import request from '@/api/index.js'

export default {
	data() {
		return {
			page: {
				total: 0,
				pageSize: 10,
				currentPage: 1
			},
			baseUrl: config.baseUrl,
			list: []
		}
	},
	onLoad() {
		this.searchArticleList()
	},
	methods: {
		searchArticleList() {
			let data = {
				page: this.page.currentPage,
				page_size: this.page.pageSize
			}
			request.searchArticleList(data).then(res => {
				console.log(res);
				this.list = res.data.list
				this.page.total = res.data.total
			})
		},
		change(currentPage, type) { // 当前页改变
			console.log("点击了" + type + "，当前页：" + currentPage);
			this.page.currentPage = currentPage;
			this.searchArticleList()
		},
		jumpPage(val) {
			uni.navigateTo({
				url: '/pages/detail/src/main?id='+val.id
			})
		}
	}
}